package file.listener;

import file.FileFrame;
import file.constant.ViewByEnum;
import file.handle.FilePannel;
import file.handle.impl.FilePannelImpl;

import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

/**
 * @Author: zou
 * @email: 704572528@qq.com
 * @Date: 2020/10/31 16:21
 */
public class ViewListener extends FileFrameAbstract implements ItemListener {

    private FilePannel filePannel = new FilePannelImpl(fileFrame);

    private ViewByEnum viewByEnum;

    public ViewListener(FileFrame fileFrame ,ViewByEnum viewByEnum) {
        super(fileFrame);
        this.viewByEnum = viewByEnum;
    }





    @Override
    public void itemStateChanged(ItemEvent e) {

        if (e.getStateChange() == ItemEvent.SELECTED) {

            ViewByEnum itemSize = (ViewByEnum) e.getItem();

            filePannel.changeFilePanel(itemSize,fileFrame.getFilePanel(),getPathLable());

        }
    }
}
